#coding=utf-8
import pandas as pd
import numpy as np

df = pd.DataFrame(np.random.randint(0, 10, size=(20, 3)), columns=['a', 'b', 'c'])
print(df)
print('--------------')
print(len(df.columns))
print('--------------')
new_df = pd.DataFrame(df, columns=['c', 'b', 'a', 'd', 'e']) # 按照这个列名排序，不足的补为nan
print(new_df)